import react from 'react'
class App extends react.Component {
  constructor() {
    super()
    this.state = {
      color: 'black'
    }
  }

  changeColor = () => {
    this.setState({
      color: 'red'
    })
  }

  render() {
    return (
      <div className="App">
        <div style={ {color: this.state.color} } onClick={this.changeColor}>点击</div>
      </div>
    );
  }
}
export default App;